async function getProd(a, b) {
    return new Promise(resolve => setTimeout(resolve, 2000, a * b))
}

/* 求n的阶乘 */
(async function(n) {
    let ret = 1,b = 2;

    while (b <= n) {
        ret = await getProd(ret, b++)
        console.log(ret);
    }

    console.log("ret=", ret);
})(5)